package service.serviceImpl;

import dao.UserMapper;
import dao.daoImpl.UserMapperImpl;
import pojo.User;
import service.UserService;

import java.sql.SQLException;
import java.util.List;

/**
 * Created by Administrator on 2017-12-10.
 */
public class UserServiceImpl implements UserService {
    UserMapper userMapper=new UserMapperImpl();
    @Override
    public List<User> getAllUser() throws SQLException {
        return userMapper.getAllUser();
    }

    @Override
    public List<User> getCurrUser(int pageNow, int page_size) throws SQLException {
        return userMapper.getCurrUser(pageNow,page_size);
    }

    @Override
    public int deleteUser(int id) throws SQLException {
        return userMapper.deleteUser(id);
    }

    @Override
    public User selectUser(int id) throws SQLException {
        return userMapper.selectUser(id);
    }

    @Override
    public int updateUserInfo(User user) throws SQLException {
        return userMapper.updateUserInfo(user);
    }

    @Override
    public int creatUserInfo(User user) throws SQLException {
        return userMapper.creatUserInfo(user);
    }

    @Override
    public String checkName(String username) throws SQLException {
        User user =userMapper.checkName(username);
        if (user==null){
            return "false";
        }
        return "true";
    }
}
